home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
C64
/
G-Games
/
(c)gb.d64
/
space nim.c
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2007-02-04
|
4KB
|
149 lines
2 REM *********************************
3 REM * MODIFIED SLIGHTLY AT 0216H ON *
4 REM * APRIL THE 5TH, 1985 BY *
5 REM * DAVID BRADLEY *
6 REM *********************************
99 REM ORIGINAL PROGRAM OF NIM APPEARED
110 REM IN P.U.N. BY JIM BUTTERFIELD
120 REM SPACE FEATURE BY MATT GANIS
130 REM "[166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166][166]
140 [143]
142 [151]53280,12:[151]53281,15:[153]""
145 V$[178]""
150 [151]53272,23:[153]"LOAD(null)(null)ATNLENVAL (null)RIGHT$(null)"
160 [153]"RIGHT$(null)(null)(null)(null)(null)LEN(null)RIGHT$(null)(null)(null)"
170 [161] R$:[139] R$[178]""[167]170
180 [139] R$[178]"Y" [167] 210
190 [139] R$[178]"N" [167] 330
200 [137] 170
210 [153]"LOAD(null)(null)ATNLENVAL (null)RIGHT$(null)WAIT RIGHT$(null)CLOSE(null)LEFT$VALCLOSE(null)(null)ATNLENVALCLOSE(null)VAL(null)(null)RIGHT$(null)(null)CLOSE(null)ASCCLOSE(null)LEFT$VAL
220 PRINT"[208][207][208][213][204][193][210][160][199][193][205][197][160][207][198][160][206][201][205]. [212][200][197][160][207][194][202][197][195][212][160][201][211][160][212][207][160]
230 [153]"(null)ATN(null)VALCLOSE(null)LEFT$VALCLOSE(null)ATN(null)(null)CLOSELEN(null)(null)(null)ATNRIGHT$(null)VAL(null)CLOSE(null)ASCCLOSEASC(null)VAL(null). (null)(null)(null) (null)ATN(null)";
240 [153]"(null)ATN(null)VALCLOSEATN(null)CLOSE(null)ATN(null)(null)CLOSELEN(null)(null)(null)ATNRIGHT$(null)VAL(null)(null)CLOSEASC(null)(null)(null)CLOSEATN(null)(null) (null)(null)VAL
250 PRINT"[208][201][204][197][160][193][211][160][217][207][213][160][204][201][203][197]. [212][200][197][160][196][210][201][207][196] [215][201][204][204][160][212][197][204][204]
260 [153]"(null)(null)(null) RIGHT$ASCCLOSE(null)(null)(null) (null)ATN(null)CLOSE(null)ATN(null)VALCLOSE(null)LEFT$ATN(null)CLOSE(null)ATN(null)(null)CLOSE
270 PRINT"[195][207][206][212][193][201][206][197][210][211][160][194][217][160][211][200][193][203][201][206][199][160][200][201][211][160][200][197][193][196][160][217][197][211][160][207][210][160]
280 [153]"(null)(null). (null)LEFT$VAL(null)CLOSEATN(null)(null)VALSTR$CLOSE'(null)LEFT$RIGHT$LENLEFT$ STR$(null)(null)RIGHT$STR$?' (null)(null)(null)
290 PRINT"[210][197][208][204][217] [215][201][212][200] [193][160]1,2 [207][210][160]3, [205][197][193][206][201][206][199][160][196][210][207][201][196] 1,
300 [153]"STR$(null)(null)RIGHT$STR$ 2 (null)(null) STR$(null)(null)RIGHT$STR$ 3.
310 PRINT" [199][207][207][196] [204][213][195][203]"
320 GET R$:IFR$=""THEN320
330 PRINT"[147]"
340 PRINT"[200][207][215] [211][200][207][213][204][196] [201] [208][204][193][217]"
350 PRINT"[205][146][197][196][201][213][205] [207][210] [212][146][207][213][199][200] ([205] [207][210][160][212])";
360 GET A$:IF A$=""THEN360
370 IF A$="T" THEN IQ=0:GOTO400
380 IF A$="M" THEN IQ=.25:GOTO400
390 GOTO 360
400 POKE53272,21:RESTORE:PRINT"[147]":A=32
410 REM ***FACES OF THE DROIDS***
420 A$(1)="[180] [182][157][157][157] [157][157][157][172] [187][157][157][157] . [157][157][157] [192] "
430 A$(2)="[187] [172][157][157][157][172] [187][157][157][157] . [157][157][157] [192] [157][157][157] "
440 A$(3)="[180] [182][157][157][157] [157][157][157] [172][172][157][157][157] .[157][157][157] [192]"
450 A$(4)="[180] [182][157][157][157] [157][157][157][187][187] [157][157][157]. [157][157][157][192] "
460 A$(5)=" [182] [157][157][157] [157][157][157] [190][157][157][157] [146][190][157][157][157][157] [195]"
470 A$(6)=" [182] [157][157][157] [157][157][157] [189][157][157][157] [146][190][157][157][157][157] [195]"
475 A$(7)="[180][160][182][157][157][157] [157][157][157] [157][157][157][188].[190][157][157][157] [192] "
480 C$(1)="[164][164][164][157][157][157][199] [200][157][157][157][199] [200][157][157][157][199] [200][157][157][157][163][163][163]"
490 C$(2)="[205] [206][157][157][157][192] [192][157][157][157]/ /[157][157][157][206] [205]"
500 C$(3)=" [157][157][157] [157][157][157] [157][157][157] [157][157][157] "
510 FOR T=1TO3:READ L(T):NEXTT:DATA 8,14,20
520 DEF FNE(X)=(A(J) OR E)AND(NOT (A(J) AND E))
530 FOR J=1TO3
540 A(J)=INT(RND(TI)*5+3)
550 IF J=1THEN580
560 FOR K=1TOJ-1:IF A(J)=A(K)THEN540
570 NEXT K
580 NEXTJ:M=0
590 GOSUB 1160
600 TC=0:A=0:PRINT"";:FORT=1TO3:PRINTTAB(A)"PILE#"CHR$(48+T)"="CHR$(48+A(T));:A=A+15
610 TC=TC+A(T):NEXTT:PRINT
620 IF TC=0 THEN 1220
630 M=1-M:IF M=0 THEN 970:REM COMPUTER'S MOVE
640 PRINT" "
650 N=0:INPUT"WHICH DROID [191][157][157][157]";D$
660 IF D$<="0" OR D$>="4" THEN 640
670 D=VAL(D$):PRINTLEFT$(V$,L(D))TAB(1)CHR$(18)CHR$(D+48)
680 INPUT"HOW MANY CONTAINERS [191][157][157][157]";C$
690 IF C$<="0" OR C$>="8" THEN680
700 ONDGOTO702,704,706
702 PRINTLEFT$(V$,12)" "A$(2)LEFT$(V$,18)"[146] "A$(2):GOTO709
704 PRINTLEFT$(V$,6)" "A$(7)LEFT$(V$,18)"[146] "A$(2):GOTO709
706 PRINTLEFT$(V$,6)" "A$(7)LEFT$(V$,12)"[146] "A$(7)
709 PRINTLEFT$(V$,D*6)" "A$(1):FORT=1TO1000:NEXTT:PRINTLEFT$(V$,D*6)" "A$(4)
710 FOR T=1TO500:NEXTT
720 PRINTLEFT$(V$,D*6)" "A$(1):PRINTLEFT$(V$,D*6)" "A$(3)
730 FORT=1TO1000:NEXTT:C=VAL(C$):IF C>A(D) THEN N=1
740 PRINTLEFT$(V$,D*6)" "A$(1)
750 IF N=1 THEN 920
760 FOR Q=1TO5:PRINTLEFT$(V$,D*6)" "A$(1):PRINTLEFT$(V$,D*6)" "A$(2)
770 NEXTQ:PRINTLEFT$(V$,D*6)" "A$(1):FORT=1TO1000:NEXTT
780 PRINTLEFT$(V$,D*6)" "A$(3):PRINTLEFT$(V$,D*6)" "A$(5)
790 FOR S=1TOC
800 FORT=1TO500:NEXTT:PRINTLEFT$(V$,D*6)" "A$(6):PRINTLEFT$(V$,L(D))TAB(6);
810 FOR T=1TO200:NEXTT:P=(L(D)-1)*40+1031
820 FOR U=1TO39:PRINT" [195][157]";
830 IF H=1 THEN 860
840 P=P+1:CT=PEEK(P):IF CT<>32 THEN H=1
850 NEXT U
860 PRINT"[145][145]"C$(2):FORT=1TO100:NEXTT:PRINT"[145][145][145][145]"TAB(U+6)C$(3):H=0
870 PRINTLEFT$(V$,D*6)" "A$(5):NEXTS
880 FOR T=1TO500:NEXTT:PRINTLEFT$(V$,D*6)" "A$(3)
890 PRINTLEFT$(V$,D*6)"[145] "LEFT$(V$,D*6)" "A$(1):FORT=1TO500:NEXTT
900 PRINTLEFT$(V$,D*6)" "A$(2):PRINT:PRINTLEFT$(V$,L(D))"[146]"TAB(1)CHR$(48+D)
910 A(D)=A(D)-C
911 FORT=1TO3:PRINTLEFT$(V$,T*6)" "A$(2):NEXTT:GOTO600
920 FOR Q=1TO5:PRINTLEFT$(V$,D*6)"[146] "A$(4)LEFT$(V$,D*6)"[146] "A$(1)
930 PRINTLEFT$(V$,D*6)" "A$(3)LEFT$(V$,D*6)"[146] "A$(1):NEXT Q
940 FORT=1TO500:NEXTT
950 PRINTLEFT$(V$,D*6)"[146] "A$(2):PRINT:PRINTLEFT$(V$,L(D))TAB(1)"[146]"CHR$(48+D)
960 PRINT" "
963 FORT=1TO3:PRINTLEFT$(V$,T*6)" "A$(2):NEXTT
965 GOTO650
970 FORT=1TO1000:NEXTT:E=0:F=0
980 FOR J=1TO3
990 E=FNE(0)
1000 IF A(J)>F THEN F=A(J):J1=J
1010 NEXTJ
1020 FOR J=1TO3
1030 R=FNE(0)
1040 IF R<=A(J)THEN1060
1050 NEXT J:STOP
1060 IF R=A(J) OR IQ>RND(1) THEN J=J1:R=A(J)-1
1070 PRINT" "
1080 PRINT"I WILL USE DROID #"J
1090 PRINTLEFT$(V$,L(J))TAB(1)CHR$(18)CHR$(48+J)
1100 FOR T=1TO1000:NEXTT
1110 PRINT" "
1120 PRINT"AND I WILL TAKE "CHR$(48+A(J)-R)" ";
1125 IFA(J)-R=1THENPRINT"CONTAINER":GOTO1140
1130 PRINT"CONTAINERS"
1140 D=J:C$=STR$(A(J)-R):GOTO700
1150 END
1160 FOR T=1TO3
1170 FORS=1TOA(T):PRINTLEFT$(V$,T*6)TAB(A)C$(1):A=A-4:NEXTS:A=32:NEXTT
1180 FOR T=1TO3
1190 PRINTLEFT$(V$,6*T)" "A$(2):NEXTT
1200 FORT=1TO3:PRINTLEFT$(V$,L(T))TAB(0)T:NEXTT
1210 RETURN
1220 W$="YOU":M$="CONGRATULATIONS":IF M=0 THEN W$="I":M$="HA HA"
1230 PRINTLEFT$(V$,13):FOR T=1TO20
1240 PRINTTAB(15)W$" WON"
1250 PRINTTAB(15)M$
1260 PRINT"[145][145]"TAB(15)""W$" WON[146]"
1270 PRINTTAB(15)""M$"[146]"
1280 PRINT"[145][145]";:NEXTT
1290 PRINTTAB(15)"ANOTHER GAME ?[146]";
1300 GET A$
1310 IF A$="Y" THEN PRINTA$:GOTO1340
1320 IF A$="N" THEN PRINTA$:PRINTTAB(15)"[147]O.K. BYE":END
1330 GOTO 1300
1340 PRINTTAB(15)"SAME LEVEL ?"
1350 GET R$:IF R$=""THEN1350
1360 IF R$="N" THEN 1390
1370 IF R$="Y" THEN 1410
1380 GOTO 1350
1390 IF IQ=0 THEN IQ=.25:GOTO1410
1400 IF IQ=.25THEN IQ=0
1410 GOTO 400